angular.module('app')
    .controller('studentListCtl', ['$scope', '$http', function ($scope, $http) {
    console.log('显示');
    $http({
        url: '/demo/student/stulist',
        method: 'get'              
    }).then(function successCallback(response) {
        console.log(response);
        $scope.studentList = response.data;
    }, function errorCallback(response) {});
    //内部方法，使用angularjs方式来完成内部事件绑定
    $scope.search = function () {
        console.log('查询功能，完成学生信息查询');
        $http({
            url: '/demo/student/findone',
            method: 'post',
            data: {keyword: $scope.keyword}
        }).then(function successCallback(response) {
            console.log('查询功能');
            $scope.studentList = response.data;
        }, function errorCallback(response) {});
    };
}])
.controller("saveStu",['$scope', '$http', function ($scope, $http) {
    console.log('学生信息添加功能');
    $http({
        url:'/demo/student/savestu',
        method:'post',
        data:$scope.student
    }).then(function successCallback(){

    },function errorCallback(){});
}]);
